$('#tel')
    .blur(function () {
        const tel = $(this).val()
        console.log(tel);
        if (tel.length == 0) return
        if (/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(tel) == false) {
            $('#yz').show()
        }
    })
    .focus(function () {
        $('#yz').hide()
    })
$('#btn').click(function () {
    const uname = $('#uname').val()
    const sex = $('#sex').val()
    const birthday = $('#birthday').val()
    const address = $('#address').val()
    const tel = $('#tel').val()
    const salary = $('#salary').val()
    const deptid = $('#deptid').val()
    const params = { uname, sex, birthday, address, tel, salary, deptid }
    console.log({params});
    if (uname && sex && birthday && address && tel && salary && deptid) {
        var url = 'http://127.0.0.1:3000/member/add'
        $.post(url, params, data => {
            if (data.code == 200) {
                alert('新增员工信息成功')
            } else {
                alert('员工添加失败')
            }
        })
    }else{
        alert('请输入完整的员工信息')
    }

})
